import {createRouter,createWebHistory} from 'vue-router'
//导入组件
import loginVue from '@/views/login.vue'
import layoutVue from '@/views/layout.vue'
//导入layoutVue子路由 ： 因为 下面这5个.vue组件是显示在layoutVue组件里面的
import ArticleCategoryVue from '@/views/article/ArticleCategory.vue'  
import ArticleManageVue from'@/views/article/ArticleManage.vue'
import UserAvatarVue from '@/views/user/UserAvatar.vue'
import UserInfoVue from '@/views/user/UserInfo.vue'
import UserResetPasswordVue from '@/views/user/UserResetPassword.vue'

//定义路由关系
//children:[]: 定义子路由
const routes = [
    {path:'/login',component:loginVue},
    {   
        path:'/',component:layoutVue,redirect:'/article/manage',children:[
            {path:'/article/Category',component:ArticleCategoryVue},
            {path:'/article/manage',component:ArticleManageVue},
            {path:'/user/info',component:UserInfoVue},
            {path:'/user/avatar',component:UserAvatarVue},
            {path:'/user/resetPassword',component:UserResetPasswordVue}
        ]
    }
]

//创建路由器
const router = createRouter({
    //路由模式
    history:createWebHistory(),
    //router关系
    routes:routes
})

//导出路由
export default router